import { atom } from "jotai";
import { ResultItemType } from "./work";

export interface SwiperItem {
	cover_image_cn: string;
	cover_image_ar: string;
	cover_image_en: string;
	cover_image_link_ar: string;
	cover_image_link_cn: string;
	cover_image_link_en: string;
	id: number;
	list?: string[];
}

export interface categoryItemType {
	id: number;
	json_content: {
		icon_all: string;
		icon_ar: string;
		icon_cn: string;
		icon_en: string;
		title_ar: string;
		title_cn: string;
		title_en: string;
	};
	sceneList: SceneItemType[];
	loading?: boolean;
}

export interface tplImageItemType{
	id: number;
	cat_s_image: string;
	cat_id: number;
}
export interface SceneItemType {
	app: string;
	app_type: string;
	charge_type: string;
	createtime: number;
	delete_time?: number;
	exclude_region: string;
	iconDesc?: string;
	iconPath?: string;
	id: number;
	include_region: string;
	json_content: {
		app_flow_id: string;
		cn: {
			desc: string;
			title: string;
		};
		cover_image_list: [
			{
				path: string;
			}
		];
		display_mode: string;
		flow_param: {
			flow_id: string;
            decorate_id:string
		};
		cover_image?: string;
	};
	points_json: {
		points: string;
	};
	type: string;
	tpl_image_list?: tplImageItemType[];
}

export interface StickerDataType {
	decorateList: [
		{
			id: number;
			name: string;
			json_data: {
				cn: {
					showData: [
						{
							name: string;
							selectVal: number;
							option: {
								list: [string];
								dataList: [string];
							};
						}
					];
				};
			};
		}
	];
	colorList: [
		{
			item: string;
			color: string;
		}
	];
}

export interface ResultShowItemType {
	id:number ;
	status:string;
	origin_img_path?:string;
	result_json:ResultItemType[]
}

// 首页频道分类数据
export const categoryListAtom = atom<categoryItemType[]>([]);
// 当前选中categoryId
export const activeCategoryIdAtom = atom(0);
// 轮播图数据
export const swiperListAtom = atom<SwiperItem[]>([]);
// sticker数据
export const stickerDataAtom = atom<StickerDataType|{}>({
	decorateList: [],
	colorList: [],
});
// 结果展示数据
export const resultShowAtom = atom<ResultShowItemType[]>([])

